package day6.Vehicle;

import java.util.Scanner;

import org.junit.Test;

public class VehiceTest {
	
	

	@Test
	public void test1() {
		Scanner scanner = new Scanner(System.in);
		System.out.print("请输入汽车的体积(kg)：");
		double size = scanner.nextDouble();

		Vehicle Car = new Vehicle(0, size);
		System.out.println("-----当前汽车的体积为"+Car.getSize());
		System.out.println("-----当前汽车的速度为"+Car.getSpeed());
		
		
		int type = 1;
		while (type != 0) {

			System.out.println("*****************");
			System.out.println("请输入指令：");
			System.out.println("需要移动请输入：1");
			System.out.println("需要加速请输入：2");
			System.out.println("需要减速请输入：3");
			System.out.println("停止请输入0");
			System.out.println("*****************");

			type = scanner.nextInt();
			double speed;
			switch (type) {
			case 1:
				Car.move();
				break;
			case 2:
				System.out.println("请输入加速的数值：");
				speed = scanner.nextDouble();
				Car.speedUp(speed);
				break;
			case 3:
				System.out.println("请输入减速的数值：");
				speed = scanner.nextDouble();
				Car.speedDown(speed);
				break;
			
			default:
				if(type != 0) {
					System.out.println("输入错误！");					
				}else {
					System.out.println("已退出");
				}
				break;
			}
		}
	}
}
